<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>新增站点信息</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/default/easyui.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/themes/icon.css"/>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/plugins/jQuery/demo.css"/>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.min.js"></script>
<script src="${pageContext.request.contextPath }/plugins/jQuery/jquery.easyui.min.js"></script>
<link rel="stylesheet" type="text/css" href="${pageContext.request.contextPath }/admin/css/input1.css"/>
<script>
	$(function(){
//		$.messager.alert('系统消息','子栏目删除成功！');
		// 区域负责人下拉列表
		$('#chargeUser').combobox({
			valueField:'userid',
			textField:'username',
			url:'${pageContext.request.contextPath }/admin/user/listUserByRole/2'
		});
		$('#chargeUser').combobox("setValue",${station.AREA_CHARGE});
		
		// 站长下拉列表
		$('#sUser').combobox({
			valueField:'userid',
			textField:'username',
			url:'${pageContext.request.contextPath }/admin/user/listUserByRole/3'
		});
		$('#sUser').combobox("setValue",${station.STATION_MASTER});
		
		// 站点类型下拉列表
		$('#stationKind').combobox({
			valueField:'value',
			textField:'text',
			data:[{"value":"1","text":"提货仓"},
				{"value":"2","text":"中心仓"}
			]
		});
		$('#stationKind').combobox("setValue",${station.STATION_KIND});
		
		// 站点市场类型
		$('#stationType').combobox({
			valueField:'value',
			textField:'text',
			data:[{"value":"1","text":"普通市场"},
				{"value":"2","text":"二批市场"},
				{"value":"3","text":"虚拟仓"},
				{"value":"4","text":"卫星城市站"},
				{"value":"5","text":"蒜米专供"}
			]
		});
		$('#stationType').combobox("setValue",${station.STATION_TYPE});
		$('#startDate').textbox('readonly', true); 
		// 站点属性下拉列表
		$('#stationProperty').combobox({
			valueField:'dict_code',
			textField:'dict_name',
			url:'${pageContext.request.contextPath }/admin/station/findStationProperty'
		});
		$('#stationProperty').combobox("setValue",'${station.STATION_PROPERTY}');
		
		$('#fb').filebox({ 
		 	buttonText: '请选择文件', 
		 	buttonAlign: 'right',
		 	editable:false 
		});
		$("a[name='qsave']").linkbutton({text:'保存站点信息',plain:true,iconCls:'icon-ok'});
		$("a[name='upload']").linkbutton({text:'重新上传',plain:true,iconCls:'icon-my-add'});
		$("a[name='find']").linkbutton({text:'点击查看',plain:true,iconCls:'icon-my-find'});
	});
	
	function uploadImg(){
		$('#upload').hide();
		$('#uploadFile').show();
	}
	
	function doSub(){
		var sname=$('#sname').val();
		if($.trim(sname)==''){
			$.messager.alert('系统消息','<span style="color:red;">站点名称必须输入！</span>');
			$('#sname').textbox('textbox').focus(); 
    		return;
		}
		var chargeUser=$('#chargeUser').combobox("getValue");
		if(chargeUser==-1){
			$.messager.alert('系统消息','<span style="color:red;">区域负责人必须选择！</span>');
			return;
		}
		var sUser=$('#sUser').combobox("getValue");
		if(sUser==-1){
			$.messager.alert('系统消息','<span style="color:red;">站长姓名必须选择！</span>');
			return;
		}
		var stationKind=$('#stationKind').combobox("getValue");
		if(stationKind==-1){
			$.messager.alert('系统消息','<span style="color:red;">站点类型必须选择！</span>');
			return;
		}
		var stationType=$('#stationType').combobox("getValue");
		if(stationType==-1){
			$.messager.alert('系统消息','<span style="color:red;">站点市场类型必须选择！</span>');
			return;
		}
		var stationProperty=$('#stationProperty').combobox("getValue");
		if(stationProperty==-1){
			$.messager.alert('系统消息','<span style="color:red;">站点市场属性必须选择！</span>');
			return;
		}
		$('#addStation').submit();
	}
</script>
</head>

<body>
<form method="post" id="addStation" action="${pageContext.request.contextPath }/admin/station/editStation" enctype="multipart/form-data">
<div class="i-container" style="width:1000px;">
	<div class="i-common i-title">编辑站点信息
		<span style="color:red; margin-left:30px;">${addMsg }</span>
		<div class="i-btn"><a id="btn" href="javascript:doSub()" name="qsave"></a></div><div style=" clear:both;"></div>
	</div>
    <div class="i-common i-cnt-left">站点名称：</div><div class="i-common i-cnt-right">
    	<input name="station.STATION_NAME" id="sname" class="easyui-textbox" style="width:210px;height:26px" value="${station.STATION_NAME }"/>
    	<input type="hidden" name="station.STATION_ID" value="${station.STATION_ID }"/>
    	<input type="hidden" name="station.STATION_AREA" value="${station.STATION_AREA }"/>
    	<input type="hidden" name="station.CREATE_TIME" value="${station.CREATE_TIME }"/>
    </div>
    <div class="i-common i-cnt-middle">站点地址：</div>
    <div class="i-common i-cnt-right">
    	<input name="station.STATION_ADDRESS" id="sname" class="easyui-textbox" style="width:210px;height:26px" value="${station.STATION_ADDRESS }"/>
    </div>
    <div class="i-common i-cnt-middle">区域负责人：</div>
    <div class="i-common i-cnt-right">
    	<input name="station.AREA_CHARGE" id="chargeUser" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div>
    <div class="i-common i-cnt-left">站长姓名：</div>
    <div class="i-common i-cnt-right">
    	<input name="station.STATION_MASTER" id="sUser" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">站长头像：</div>
    <div class="i-common i-cnt-right">
    	<input type="hidden" name="station.IMG_URL" value="${station.IMG_URL }"/>
   		<c:choose>
			<c:when test="${station.IMG_URL eq null }">
				<div id="uploadFile"><input class="easyui-filebox" id="fb" name="img" data-options="prompt:'请选择站长头像图片...'" style="width:210px;height:26px" accept="image/gif,image/jpeg,image/png"/></div>
			</c:when>
			<c:when test="${station.IMG_URL ne null }">
				<div id="uploadFile" style="display:none;"><input id="fb" class="easyui-filebox" name="img" data-options="prompt:'请选择站长头像图片...'" style="width:210px;height:26px" accept="image/gif,image/jpeg,image/png"/></div>
				<div id="upload">
 					<span style="width:130px; font-size:12px;color:red;">已上传</span>	    					
 					<a id="btn" href="javascript:showImg('${ station.IMG_URL}')" name="find"></a>
 					<a id="btn" href="javascript:uploadImg()" name="upload"></a>
				</div>
			</c:when>
		</c:choose>
    </div>
    <div class="i-common i-cnt-middle">站点类型：</div>
    <div class="i-common i-cnt-right">
    	<input name="station.STATION_KIND" id="stationKind" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div> 
    <div class="i-common i-cnt-left">站点投诉电话：</div>
    <div class="i-common i-cnt-right">
		<input name="station.REPORT_PHONE" id="sname" class="easyui-textbox" style="width:210px;height:26px" value="${station.REPORT_PHONE }"/>
	</div>
    <div class="i-common i-cnt-middle">市场类型：</div>
    <div class="i-common i-cnt-right">
    	<input name="station.STATION_TYPE" id="stationType" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div class="i-common i-cnt-middle">市场属性：</div>
    <div class="i-common i-cnt-right">
    	<input name="station.STATION_PROPERTY" id="stationProperty" class="easyui-textbox" style="width:210px;height:26px"/>
    </div>
    <div style="clear:both;"></div>
    
    <div class="i-common i-cnt-left">需到货时间：</div>
    <div class="i-common i-cnt-right">
		<input name="station.SEND_TIME" id="send_time" class="easyui-textbox" style="width:210px;height:26px" value="${station.SEND_TIME }"/>
	</div>
    <div class="i-common i-cnt-middle">&nbsp;</div>
    <div class="i-common i-cnt-right">
    	&nbsp;
    </div>
    <div class="i-common i-cnt-middle">&nbsp;</div>
    <div class="i-common i-cnt-right">
    	&nbsp;
    </div>
    <div style="clear:both;"></div>
</div>

</form>
</body>
</html>
